package com.projecy.storehouse.controller;

import com.projecy.storehouse.service.*;
import com.projecy.storehouse.util.RepertoryResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * 出库
 * author: mao yi
 * date: 2023/3/27
 * TheDispatch:
 */
@RestController
@RequestMapping("sys")
public class OutDispatchController {

    @Autowired
    TheLibraryService theLibraryService;

    @Autowired
    TheLibraryDefaultService theLibraryDefaultService;

    @Autowired
    ProductUnitService productUnitService;

    /**
     * 入库调度
     */

    /**
     * 调度入库查询
     * reason,current
     * @return
     */
    @GetMapping("/outDispatch/list1/{reason}/{current}")
    public ResponseEntity<Object> seachPutDispatch(@PathVariable String reason){
        return RepertoryResultUtil.success(true,theLibraryService.seacherTheLibraryDispatchMark(reason,"待调度"));
    };

    /**
     * @GetMapping("/outStorage/list1")
     */


    /**
     *点击调度
     * @param productId
     * @return
     */
    @GetMapping("/outDispatch/list2")
    public ResponseEntity<Object> checkDispatch(@RequestBody Long productId){
        return RepertoryResultUtil.success(true,theLibraryService.checkTheLibraryDispatch(productId));
    }


    /**
     * 总调度
     * @param putId
     * @param uname
     * @return
     */
    @PostMapping("/outDispatch/update/{putId}/{uname}")
    public ResponseEntity<Object> checkDispatchAll(@PathVariable Long putId,@PathVariable String uname){
        return theLibraryService.checkTheLibraryDispatchAll(putId,uname);
    }
}
